﻿using Newtonsoft.Json;

namespace Minecraft_Armor_Stand_Creater.Util
{
    /// <summary> json操作模块 </summary>
    class JsonOperator
    {
        /// <summary> json对象序列化为文本 </summary>
        /// <param name="obj">json对象</param>
        /// <returns> json字符串 </returns>
        public static string Serialize<T>(T obj)
        {
            return JsonConvert.SerializeObject(obj);
        }

        /// <summary> json文本反序列化为对象 </summary>
        /// <param name="json">json文本</param>
        /// <returns> json对象 </returns>
        public static T Diserialize<T>(string json)
        {
            return JsonConvert.DeserializeObject<T>(json);
        }
    }

}
